<!-- 
此组件初始化时不会自动加载数据，请在mounted中 this.$refs.[].initData()
如果放在dialog里面的吗，请在dialog的open事件中用this.$nextTick进行加载
 -->
<template>
  <div>
    <list
      ref="list"
      unit="账单费用变更记录"
      :disabled="disabled"
      :show-query="showQuery"
      show-checkbox
      :query-params="queryParams"
      :expand-query="expandQuery"
      :show-summary="showSummary"
      :page="page"
      :get-page-list-func="api.getChargeCdcPageList"
    >
      <template #toolbar-left>
        <slot name="toolbar-left"></slot>
      </template>
      <template #query>
        <div>
          <el-form-item label="币种">
            <el-input
              v-model.trim="queryParams.currency"
              placeholder="费用币种"
              clearable
            ></el-input>
          </el-form-item>
          <el-form-item label="操作类型">
            <el-select
              v-model="queryParams.cdcOperationTypes"
              clearable
              multiple
              collapse-tags
            >
              <el-option
                label="创建"
                :value="2"
              ></el-option>
              <el-option
                label="更新[旧值]"
                :value="3"
              ></el-option>
              <el-option
                label="更新[新值]"
                :value="4"
              ></el-option>
              <el-option
                label="删除"
                :value="1"
              ></el-option>
            </el-select>
          </el-form-item>
        </div>
      </template>
      <template #column>
        <el-table-column
          label="费用ID"
          prop="id"
          width="260"
        />
        <el-table-column
          label="费用名称"
          prop="chargeCodeName"
        />
        <el-table-column
          label="操作类型"
          prop="cdcOperationTypeName"
          width="80"
        />
        <el-table-column
          label="币种"
          prop="currency"
          width="60"
          align="center"
        />
        <el-table-column
          label="金额"
          prop="amount"
          width="80"
          align="right"
        >
          <template v-slot="{row}">
            ￥{{row.amount}}
          </template>
        </el-table-column>
        <el-table-column
          prop="creatorUserName"
          width="80"
          label="创建人"
        />
        <el-table-column
          prop="lastModifierUserName"
          width="80"
          label="修改人"
        />
        <el-table-column
          prop="creationTime"
          width="120"
          label="创建时间"
          sortable="custom"
        >
          <template v-slot="{ row }">
            <span>{{ row.creationTime | toShortDatetimeString }}</span>
          </template>
        </el-table-column>
        <el-table-column
          prop="lastModificationTime"
          width="120"
          label="修改时间"
          sortable="custom"
        >
          <template v-slot="{ row }">
            <span>{{ row.lastModificationTime | toShortDatetimeString }}</span>
          </template>
        </el-table-column>
        <el-table-column
          prop="cdcTime"
          width="120"
          label="记录时间"
          sortable="custom"
        >
          <template v-slot="{ row }">
            <span>{{ row.cdcTime | toShortDatetimeString }}</span>
          </template>
        </el-table-column>
        <!-- slot[column] -->
        <slot name="column"></slot>
        <!--/ slot[column]-->
      </template>
    </list>
  </div>
</template>
<script>
import listMixin from "@/mixins/list";
import list from "@/components/common/list";
import api from "@/api/fam/bill";
export default {
  mixins: [listMixin],
  components: {
    list
  },
  props: {},
  data() {
    return {
      //查询条件字段
      queryParams: {
        invoiceNo: "",
        invoiceCode: "",
        serialNo: "",
        buyerTitleName: "",
        sellerTitleName: "",
        statuses: [],
      },
      api,
    };
  },
  methods: {
    getStatusType(status) {
      var text = "";
      switch (status) {
        case 0:
          text = "info";
          break;
        case 1:
          text = "";
          break;
        case 2:
          //作废
          text = "info";
          break;
        case 3:
          //冲红
          text = "warning";
          break;
        case 6:
          text = "danger";
          break;
      }
      return text;
    },
    openInvoice(url) {
      window.open(url);
    },
    openDetail(id) {
      this.$refs.detailDialog.openDetail(id);
    }
  },
};
</script>